package com.jiayi.data.converter;

import com.jiayi.data.entity.schema.JiayiNews;
import com.jiayi.data.entity.excel.JiayiNewsExcel;
import com.jiayi.data.entity.bo.JiayiNewsBO;
import com.jiayi.data.entity.request.JiayiNewsRequest;
import com.jiayi.data.entity.request.JiayiNewsSearchRequest;
import com.jiayi.data.entity.request.JiayiNewsSearchPageRequest;
import com.jiayi.data.entity.response.JiayiNewsDTO;
import org.springframework.stereotype.Component;

/**
 * 新闻动态对象 Converter
 *
 * @author zzx
 * @date 2024-11-26
 */
@Component
public class JiayiNewsConverter {

    public JiayiNews convertToJiayiNews(JiayiNewsBO from) {
        if (from == null) {
            return null;
        }
        JiayiNews to = new JiayiNews();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNewsBO convertToJiayiNewsBO(JiayiNewsSearchRequest from) {
        if (from == null) {
            return null;
        }
        JiayiNewsBO to = new JiayiNewsBO();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNewsBO convertToJiayiNewsBO(JiayiNewsRequest from) {
        if (from == null) {
            return null;
        }
        JiayiNewsBO to = new JiayiNewsBO();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNewsBO convertToJiayiNewsBO(JiayiNews from) {
        if (from == null) {
            return null;
        }
        JiayiNewsBO to = new JiayiNewsBO();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNews convertToJiayiNews(JiayiNewsRequest from) {
        if (from == null) {
            return null;
        }
        JiayiNews to = new JiayiNews();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNews convertToJiayiNews(JiayiNewsSearchPageRequest from) {
        if (from == null) {
            return null;
        }
        JiayiNews to = new JiayiNews();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNews convertToJiayiNews(JiayiNewsSearchRequest from) {
        if (from == null) {
            return null;
        }
        JiayiNews to = new JiayiNews();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNewsDTO convertToJiayiNewsDTO(JiayiNewsBO from) {
        if (from == null) {
            return null;
        }
        JiayiNewsDTO to = new JiayiNewsDTO();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNewsDTO convertToJiayiNewsDTO(JiayiNews from) {
        if (from == null) {
            return null;
        }
        JiayiNewsDTO to = new JiayiNewsDTO();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }

    public JiayiNewsExcel convertToJiayiNewsExcel(JiayiNews from) {
        if (from == null) {
            return null;
        }
        JiayiNewsExcel to = new JiayiNewsExcel();
        to.setId(from.getId());
        to.setName(from.getName());
        to.setTypeId(from.getTypeId());
        to.setPoster(from.getPoster());
        to.setInfo(from.getInfo());
        to.setDate(from.getDate());
        to.setIsHome(from.getIsHome());
        to.setRemark(from.getRemark());
        to.setCreateBy(from.getCreateBy());
        to.setCreateTime(from.getCreateTime());
        return to;
    }


}